# Contributor: Luca Weiss <luca@z3ntu.xyz>
# Maintainer: Luca Weiss <luca@z3ntu.xyz>
pkgname=ayatana-indicator-session
pkgver=23.10.3
pkgrel=0
pkgdesc="Ayatana Indicator Session Applet"
url="https://github.com/AyatanaIndicators/ayatana-indicator-session"
arch="all"
license="GPL-3.0-only"
makedepends="
	cmake
	cmake-extras
	glib-dev
	gtest-dev
	intltool
	libayatana-common-dev
	librda-dev
	samurai
	"
checkdepends="dbus"
subpackages="$pkgname-lang"
source="https://github.com/AyatanaIndicators/ayatana-indicator-session/archive/$pkgver/ayatana-indicator-session-$pkgver.tar.gz"

build() {
	if [ "$CBUILD" != "$CHOST" ]; then
		CMAKE_CROSSOPTS="-DCMAKE_SYSTEM_NAME=Linux -DCMAKE_HOST_SYSTEM_NAME=Linux"
	fi
	cmake -B build -G Ninja \
		-DCMAKE_INSTALL_PREFIX=/usr \
		-DCMAKE_INSTALL_LIBDIR=lib \
		-DBUILD_SHARED_LIBS=True \
		-DCMAKE_BUILD_TYPE=MinSizeRel \
		-DENABLE_TESTS=ON \
		$CMAKE_CROSSOPTS .
	cmake --build build
}

check() {
	cd build
	# https://github.com/AyatanaIndicators/ayatana-indicator-session/issues/90
	CTEST_OUTPUT_ON_FAILURE=TRUE ctest -E test-service
}

package() {
	DESTDIR="$pkgdir" cmake --install build
}

sha512sums="
ee00682f705a7a4f906ab07e8a5ccc543a19d2e403b9fd3c23a2854d9ac4005c345a40f52a3c1cc09f8d19bbf84c82b825500a095d01fd3f3cc26b83d97ee6ef  ayatana-indicator-session-23.10.3.tar.gz
"
